using Cinemachine;
using UnityEngine;

public class CameraSwitchTrigger : TriggerBase
{
    public CustomInspectorObjects customInspectorObjects;
    [SerializeField] private SwicthDirection _swicthDirection;

    protected override void OnTriggerExit2D(Collider2D other)
    {
        base.OnTriggerExit2D(other);
        if (other.CompareTag("Player") == false)
            return;

        Vector2 exitDirection = (other.transform.position - _coll.bounds.center).normalized;

        if (_swicthDirection == SwicthDirection.Vertical)
            CameraManager.Instance.SwapCameraVertical(customInspectorObjects.cameraOnDown, customInspectorObjects.cameraOnUp, exitDirection);
        else
            CameraManager.Instance.SwapCameraHorizontal(customInspectorObjects.cameraOnLeft, customInspectorObjects.cameraOnRight, exitDirection);
    }
}



[System.Serializable]
public class CustomInspectorObjects
{
    public CinemachineVirtualCamera cameraOnDown;
    public CinemachineVirtualCamera cameraOnUp;
    public CinemachineVirtualCamera cameraOnLeft;
    public CinemachineVirtualCamera cameraOnRight;
}
